package com.financing.model;
import java.util.HashMap;
import java.util.Map;

public class Data {
	public static Map<Object, Object> put (Object... paras) {
		HashMap<Object,Object> data = new HashMap<Object,Object>();
		for (int i=0; i<paras.length-1; i=i+2) {
			data.put(paras[i], paras[i+1]);
		}
		return data;
	}

	public static Map<String, String> putStr(String... paras) {
		HashMap<String,String> data = new HashMap<String,String>();
		for (int i=0; i<paras.length-1; i=i+2) {
			data.put(paras[i], paras[i+1]);
		}
		return data;
	}
	

	/**
	 * 二维参数Map扁平化
	 */
	public static Map<String, String> flat(Map<String, String[]> map) {
		Map<String, String> params = new HashMap<String, String>();
		map.forEach((k,v)->{
			if(v!=null && v.length>0){
				params.put(k, v[0]);
			}
		});
		return params;
	}
}


